home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 16 / IOPROG_16.ISO / soft / macaxsdk / macsdk.hqx / ActiveX DR3 SDK / ActiveX SDK / Common / CObjectDesc.h / CObjectDesc.h
Encoding:
Text File  |  1997-07-24  |  5.6 KB  |  147 lines  |  [TEXT/CWIE]

  1.  
  2. /**************** Resource format Constants **************/
  3.  
  4. const OSType    kAXObjInfoResType = 'OInf';        // Object Info Resource Type
  5. const short        kAXObjInfoStart = 128;            // Resource number for axID resources
  6. const OSType    kAXMethListResType = 'Mth#';    // Method List Resource Type
  7. const short        kAXMethResIDStart = 128;        // Starting resource number for method list resources
  8. const OSType    kAXParamListResType = 'Prm#';    // Parameter List Resource Type
  9. const short        kAXParamResIDStart = 128;        // Starting resource number for param list resources
  10.  
  11. // String indexes in the STR# resource pointed to by the InfoRsrc.StringListResID
  12. enum
  13. {
  14.     kAXClassIDStrIndex = 1,        // Index in STR# resource that holds the class id
  15.     kAXUserNameStrIndex = 2,    // Index in STR# resource that holds the User Name
  16.     kAXProgIDStrIndex = 3,        // Index in STR# resource that holds the ProgID
  17.     kAXFragNameStrIndex = 4,    // Index in STR# resource that holds the Frag Name
  18.     kAXCodeBaseExtIndex = 5        // Index in STR# resource that holds the Codebase extension
  19. };
  20.  
  21. typedef Str255    AXRsrcName;
  22.  
  23. // Object Info resource
  24. typedef struct
  25. {
  26.     Uint16    StringListResID;    // Res ID of string list resource that holds strings
  27.     Uint16    MimeListResID;        // Res ID of string list resource that holds mime strings
  28.     Uint32    DefaultHeight;        // Default Height
  29.     Uint32    DefaultWidth;        // Default width
  30.     Uint32    UnusedLongs[6];        // Unused space at end
  31. }
  32. AXInfoRsrc, **AXInfoRsrcHdl;
  33.  
  34. // Method description resource
  35. typedef struct
  36. {
  37.     Uint32            Unused[4];        // Unused space for future expansion
  38.     DISPID            DispID;            // Invocation ID
  39.     AXMethodKind    Kind;            // property, method or event
  40.     Uint16            ParamsResID;    // Rsrc ID of parameter list (value list for properties)
  41.     VARTYPE            ReturnType;        // Return Type
  42.     Uint16            Size;            // Total size of this member
  43.     AXRsrcName        Name;            // Name of the method ( or property name )
  44. }
  45. AXMethodRsrc, *AXMethodRsrcPtr, **AXMethodRsrcHdl;
  46.  
  47. // Method Description List resource
  48. typedef struct
  49. {
  50.     Uint32            Unused[4];        // Unused space for future expansion
  51.     Uint16            Unused5;        // Unused word for future expansion
  52.     Uint16            InIIDRes;        // Res ID of IID resource for default incoming dispatch interface (0 for IDispatch)
  53.     Uint16            OutIIDRes;        // Res ID of IID resource for default outgoing dispatch interface (0 for IDispatch)    
  54.     Uint16             NumMethods;        // Number of methods in the method list
  55.     AXMethodRsrc    MethodRsrc[1];    // List of method descriptions
  56. }
  57. AXMethodListRsrc, *AXMethodListRsrcPtr, **AXMethodListRsrcHdl;
  58.  
  59.  
  60. // Parameter Description Resource
  61. typedef struct
  62. {
  63.     Uint32        Unused[4];    // Unused space for future expansion
  64.     VARTYPE        Type;        // Type of parameter - VARIANT mapping
  65.     Uint16        Size;        // Size of this member
  66.     AXRsrcName    Name;        // Method param name, property string value    
  67. }
  68. AXParamRsrc, *AXParamRsrcPtr;
  69.  
  70. // Parameter Description List Resource
  71. typedef struct
  72. {
  73.     Uint32        Unused[4];        // Unused space for future expansion
  74.     Uint16        ValueIndex;        // 1-based Index in list of the property value parameter, 0 for methods and events
  75.     Uint16         ParamCount;        // Number of parameters in the list
  76.     AXParamRsrc    ParamRsrc[1];    // Param Descriptions
  77. }
  78. AXParamListRsrc, *AXParamListRsrcPtr, **AXParamListRsrcHdl;
  79.  
  80.  
  81.  
  82. class CObjectDesc :
  83.     public CBaseCOM,
  84.     public IObjectInfo, 
  85.     public IObjectDesc
  86. {
  87. public:
  88.     // *** CObjectDesc methods ***
  89.                     CObjectDesc(void);
  90.                     CObjectDesc(AXPlatformFileRef inRef);
  91.                     ~CObjectDesc(void);
  92.     
  93.     // *** IUnknown methods ***
  94.     STDMETHOD (QueryInterface) (THIS_ REFIID inRefIID, void **outObj);
  95.     STDMETHOD_(Uint32,AddRef) (THIS) { return CBaseCOM::AddRef(); }
  96.     STDMETHOD_(Uint32,Release) (THIS) { return CBaseCOM::Release(); }
  97.  
  98.     // **** IObjectInfo methods ***
  99.     STDMETHOD (GetClassID) (THIS_ CLSID* outID );
  100.     STDMETHOD (GetIDString) (THIS_ AXIDKind inKind, Uint32 inBufferSize, char* outStringID);
  101.     STDMETHOD (GetDefaultSize) (THIS_ AXPlatformPoint* outDefaultSize);
  102.     
  103.     // **** IObjectDesc methods ***
  104.     STDMETHOD (GetInterfaceID) (THIS_ AXMethodKind inKind, IID* outID) ;
  105.     STDMETHOD_(Uint32, GetCount) (THIS_ AXMethodKind inKind) ;
  106.     STDMETHOD (GetMethodDesc) (THIS_ AXMethodKind inKind, Uint32 inIndex, AXMethodDesc* outDesc ) ;
  107.     
  108.     // *** IPropertyBag methods ***
  109.     STDMETHOD(Read) (THIS_ LPCOLESTR inPropName, LPVARIANT outVariant, LPERRORLOG ioErrorLog);
  110.     STDMETHOD(Write) (THIS_ LPCOLESTR inPropName, LPVARIANT inVariant);
  111.  
  112.     STDMETHOD_(Int16,GetMimeResID) (THIS) {return mMimeListResID;}
  113.  
  114. protected:
  115.     // *** members ***
  116.     CLSID            mClassID;        // Class ID for this object
  117.     AXRsrcName        mClassIDStr;    // String representation of ClassID
  118.     AXRsrcName        mUserName;        // String representation of UserName
  119.     AXRsrcName        mProgID;        // String representation of ProgID
  120.     AXRsrcName        mFragName;        // String representation of fragment name
  121.     AXRsrcName        mCodebaseExt;    // String that holds the codebase extension of the control
  122.     Uint32            mDefaultHeight;    // Default height of the object
  123.     Uint32            mDefaultWidth;    // Default width of the object
  124.     Int16            mMimeListResID;        // MimeListResID from the Object Info Resource
  125.         
  126.     IID        mInDispatch;    // Incoming IDispatch IID
  127.     IID        mOutDispatch;    // Outgoing IDispatch IID
  128.     LArray*    mProps;            // List of properties
  129.     LArray* mMethods;        // List of methods
  130.     LArray* mEvents;        // List of events
  131.     
  132.     Boolean    mObjectInfoLoaded;    // True if axID resource has been loaded
  133.     Boolean mObjectDescLoaded;    // true if object description resources have been loaded
  134.     
  135.     // *** methods ***
  136.     void             AddMethodDesc(Int16 inIndex, AXMethodDesc* inDesc);
  137.     void             CopyMethodRsrcToDesc(AXMethodRsrcPtr MethodRsrcP, AXMethodDesc* inDesc);
  138.     void             DestroyDescs(LArray* inDescs);
  139.     void             GetDesc(LArray* inDescs, Uint16 inIndex, AXMethodDesc* outDesc);
  140.     void            Initialize(void);
  141.     AXErrorCode     ReadObjectInfo (AXPlatformFileRef inRef);
  142.     AXErrorCode     ReadObjectDesc (AXPlatformFileRef inRef);
  143.     
  144. };
  145.  
  146.  
  147.